import sys
from model.user_model import UserModel

class LoginService:
    def __init__(self,user,pwd):
        self.user = user
        self.pwb = pwd
    def login(self):
        user = UserModel(user=self.user)
        user_data=user.get_by_user()
        if user_data:
            if self.pwb == user_data[0]['pwd']:
                return True
            else:
                return False
        else:
            return False


if __name__ == '__main__':
    login_service = LoginService(user='23',pwd='5')
    tuser = UserModel(user=login_service.user)
    # user_data = tuser.get_by_user()
    # print('user_data:',user_data)
    a = login_service.login()
    print(a)

